import { searchGoods } from "../../../api/search";

const state = {
  trademarkList: [],
  attrsList: [],
  goodsList: [],
  total: 0,
};
const getters = {};
const actions = {
  async searchGoods({ commit }, data) {
    const res = await searchGoods(data);
    commit("SEARCH_GOODS", res);
  },
};
const mutations = {
  SEARCH_GOODS(state, res) {
    console.log("SEARCH_GOODS===>", res);
    state.trademarkList = res.trademarkList;
    state.attrsList = res.attrsList;
    state.goodsList = res.goodsList;
    state.total = res.total;
  },
};

export default {
  namespaced: true, // 启用命名空间
  state,
  getters,
  mutations,
  actions,
};
